﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;

namespace ProjectEuler
{
    internal class Problem23
    {
        public void Solve()
        {
            var MAX = 28123;
            var abundants = new List<int>();
            var theNums = new bool[MAX + 1];
            // find abundants
            for (var i = 12; i <= MAX; i++)
            {
                if (Common.IsAbundant(i))
                {
                    abundants.Add(i);
                }
            }

            // find all the sums
            foreach (int t in abundants)
            {
                foreach (int t1 in abundants)
                {
                    var athroisma = t + t1;
                    if (athroisma <= MAX)
                        theNums[athroisma] = true;
                }
            }
            var sum = 0;

            for (int i = 0; i < theNums.Length; i++)
            {
                if (theNums[i] == false)
                    sum += i;
            }
            
            Debug.WriteLine("problem 23:  " + sum);
            Debug.WriteLine("da?");
        }
    }
}